var {createApp} = Vue 
createApp({
    data(){
        return{
            startTime:"2023-06-13 14:00:00",
            endTime:"2023-06-13 16:00:00",
            now:new Date()
        }
    },
    computed:{
        msStart(){
            var date = new Date(this.startTime)
            var h = date.getHours()
            var min = date.getMinutes()
            min = min < 10 ? "0"+min : min;
            return h + ":" + min
        },
        msEndH(){
            var date = new Date(this.endTime)
            var delta = date.getTime() - this.now.getTime()
            var h = Math.floor( delta/1000/3600)
            console.log(h)
            h = h < 10 ? "0" + h : h;
            return h
        },
        msEndM(){
            var date = new Date(this.endTime)
            var delta = date.getTime() - this.now.getTime()
            var m = Math.floor(delta/1000/ 60)
            m = m < 10 ? "0" + m : m;
            return m
        },
        msEndS(){
            var date = new Date(this.endTime)
            var delta = date.getTime() - this.now.getTime()
            var s = Math.floor(delta/1000%60)
            s = s < 10 ? "0" + s : s;
            return s
        },

    },
    mounted(){
        setInterval(() =>{
            this.now = new Date()
        },1000)
    }
}).mount("#app")